<%@page contentType="text/html; charset=UTF-8" %>
<jsp:useBean id="user" class="entity_beans.User" scope="session"></jsp:useBean>
<jsp:useBean id="auxBean" class="model.AuxBean" scope="request"></jsp:useBean>

<%@page import="entity_beans.Flight" %>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Air Transport - Reservation</title>
</head>
<body>
<%! Flight flight = null; %>
<%
	if (user.isAccessed() == false) {
		response.sendRedirect("../index.jsp");
		return;
	}

	if ( user.isLoggedIn() == false ) {
		response.sendRedirect("../index.jsp");
		return;
	}
	
	String flightID = request.getParameter("flightid");
	
	if (flightID == null) {
		response.sendRedirect("main.jsp");
		return;
	}
	
	flight = auxBean.getFlightByID(flightID);
	
	if (flight == null) {
		response.sendRedirect("main.jsp");
		return;
	}
%>



<h2><u>Air Transport Service - Reservation</u></h2>

<jsp:include page="header.jsp"></jsp:include>

	<table border="1">
		<tr bgcolor="lightgrey">
			<td style="BACKGROUND-COLOR: #b7d0ec;">Flight ID:</td><td style="BACKGROUND-COLOR: #e7cfad;"><%= flight.getId() %></td>
		</tr>
		<tr bgcolor="lightgrey">
			<td style="BACKGROUND-COLOR: #b7d0ec;">Departure Time:</td><td style="BACKGROUND-COLOR: #e7cfad;"><%= flight.getDepartureTimeFormated() %></td>
		</tr>
		<tr bgcolor="lightgrey">
			<td style="BACKGROUND-COLOR: #b7d0ec;">Source:</td><td style="BACKGROUND-COLOR: #e7cfad;"><%= flight.getSource() %></td>
		</tr>
		<tr bgcolor="lightgrey">
			<td style="BACKGROUND-COLOR: #b7d0ec;">Destination:</td><td style="BACKGROUND-COLOR: #e7cfad;"><%= flight.getDestination() %></td>
		</tr>
	</table>
	
<hr />

<form name="forma" method="post" action="../ReservationServlet">

<input type="hidden" name="flightid" value=<%= flightID %>>

<table BORDER="2" cellspacing="2">

<tr>
<td style="BACKGROUND-COLOR: #a8da8f;">JMBG:</td>
<td align="center">
<input id="jmbg" name="jmbg" size="20"  TYPE="TEXT" style="float:left"></td>
</tr>
<tr>
<td style="BACKGROUND-COLOR: #a8da8f;">Name:</td>
<td align="center">
<input id="name" name="name" size="20"  TYPE="TEXT" style="float:left"></td>
</tr>
<tr>
<td style="BACKGROUND-COLOR: #a8da8f;">Surname:</td>
<td align="center">
<input id="surname" name="surname" size="20"  TYPE="TEXT" style="float:left"></td>
</tr>

<tr align="center">
<td bgcolor="#CCCCCC">&nbsp;</td>
<td bgcolor="#CCCC99">
  <INPUT TYPE="submit" NAME="submit" VALUE="Reserve"></td>
</tr>
</table>

</form>

<hr width="30%" align="left">


<a href="main.jsp">Main Page - Flight List</a>


<jsp:include page="footer.jsp"></jsp:include>
		
</body></html>